<template>
  <div>

    <el-container>
      <el-header>
        <div class="header-right">
<!--          <a>{{userInfo.username}}</a>-->
          <a>{{userInfo.name}}</a>
          <a @click.prevent="logout">退出</a>
        </div>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu
            :default-active="this.$route.path"
            router
            default-active="/storeManger"
            class="el-menu-vertical-demo">
<!--            <el-submenu index="1">-->
<!--              <template slot="title">-->
<!--                <i class="el-icon-s-shop"></i>-->
<!--                <span>商家管理</span>-->
<!--              </template>-->
<!--              <el-menu-item index="/storeManger">商家信息</el-menu-item>-->
<!--              <el-menu-item index="/approval">注册审批</el-menu-item>-->
<!--            </el-submenu>-->
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>店铺管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/storeBackStageManage/storeInfo">
                  店铺信息
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>

            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>餐品菜品管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/storeBackStageManage/productsInfo">
                  餐品管理
                </el-menu-item>
                <el-menu-item index="/storeBackStageManage/foodManage">
                  菜品管理
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>

            <el-submenu index="3">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>店铺订单管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/storeBackStageManage/storeOrder">
                  订单信息
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>

            <el-submenu index="4">
              <template slot="title">
                <i class="el-icon-s-shop"></i>
                <span>商家管理</span>
              </template>
              <el-menu-item index="/storeManger">商家信息</el-menu-item>
              <el-menu-item index="/approval">注册审批</el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>

  </div>
</template>

<script>
  export default {
    name: "SystemMain",
    data() {
      return {
        userInfo: {}
      }
    },
    methods: {
      logout(){
        this.$http.get("/logout");
      }
    },
    created() {
      let str = localStorage.getItem("userInfo");
      this.userInfo = JSON.parse(str)
      console.log(this.userInfo)
    }
  }
</script>

<style >
  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
    overflow: hidden;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .header-right {
    position: absolute;
    right: 200px;
  }

  .header-right > a {
    margin-right: 10px;
  }
</style>
